﻿/*
/*NHibernate映射代码模板
/*吕震修改使用升级版My Generation映射 Oracle
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Model.Common;


namespace Model
{
	/// <summary>
	///	Image:图片
	/// </summary>
	[Serializable]
	public partial class Image : IDataEntity 
	{
		#region 私有成员
			
		private bool keyIsChanged;
		private bool keyIsDeleted;
		private int keyImageId; 
		private string keyImageName; 
		private int keyVersion; 		
		
		#endregion
		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public Image()
		{
			keyImageId = 0; 
			keyImageName = null; 
			keyVersion = 0; 
		}
		#endregion
		
		#region  公有属性
			
		
		/// <summary>
		/// ImageId:图片id
		/// </summary>		
		public virtual int ImageId
		{
			get { return keyImageId; }
			set { IsChanged |= (keyImageId != value); keyImageId = value; }
		}
			
		
		/// <summary>
		/// ImageName:图片名称
		/// </summary>		
		public virtual string ImageName
		{
			get { return keyImageName; }
			set	
			{
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("ImageName:图片名称无效!", value, value.ToString());
				
				IsChanged |= (keyImageName != value); keyImageName = value;
			}
		}
			
		
		/// <summary>
		/// Version:版本号
		/// </summary>		
		public virtual int Version
		{
			get { return keyVersion; }
			set { IsChanged |= (keyVersion != value); keyVersion = value; }
		}
			
			
		/// <summary>
		/// 对象是否为新增
		/// </summary>
		public virtual bool IsAdded
		{
			get { return keyImageId == 0 ? true : false; }
		}
			
		/// <summary>
		/// 对象的值是否被改变
		/// </summary>
		public virtual bool IsChanged
		{
	 		get { return keyIsChanged; }
            set { keyIsChanged = value; }
		}
		
		/// <summary>
		/// 对象是否已经被删除
		/// </summary>
		public virtual bool IsDeleted
		{
			get { return keyIsDeleted; }
		}
		
		#endregion 
		
		#region 公有函数
		
		/// <summary>
		/// 标记对象已删除
		/// </summary>
		public virtual void MarkAsDeleted()
		{
			keyIsDeleted = true;
			keyIsChanged = true;
		}
		
		/// <summary>
		/// 初始化对象标记
		/// </summary>
		public virtual void ResetMark()
		{
			keyIsDeleted = false;
			keyIsChanged = false;
		}
		
		#endregion
		
		#region 重写Equals和HashCode
		/// <summary>
		/// 用唯一值实现Equals
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != GetType() ) ) return false;
			Image castObj = (Image)obj; 
			return ( castObj != null ) &&
				(keyImageId == castObj.ImageId );
		}
		
		/// <summary>
		/// 用唯一值实现GetHashCode
		/// </summary>
		public override int GetHashCode()
		{
			int hash = 57; 
			hash = 27 * hash * keyImageId.GetHashCode();
			return hash; 
		}
		#endregion
		
		
	}
}
